package com.kaisu.blog.infrastructure.file.convert;

import com.kaisu.blog.domain.file.File;
import com.kaisu.blog.infrastructure.file.FilePO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;

/**
 * @author kaisu
 */
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING)
public interface FileConvert {
    @Mapping(target = "updateTime", ignore = true)
    @Mapping(target = "createTime", ignore = true)
    FilePO toPO(File file);

    @Mapping(target = "previewPath", ignore = true)
    @Mapping(target = "md5", ignore = true)
    @Mapping(target = "storagePath", ignore = true)
    File toDomain(FilePO filePO);
}
